package com.trg.designmodel.factory.Simplefactory.order;

import com.trg.designmodel.factory.Simplefactory.pizza.CheesPizza;
import com.trg.designmodel.factory.Simplefactory.pizza.GreekPizza;
import com.trg.designmodel.factory.Simplefactory.pizza.Pizza;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * @ClassName: SimpleFactory
 * @Description: 工厂设计模式-使用简单工厂的方式实现
 * @Author: tangrg
 * @Date: 2021/7/1 11:21
 * @Version: 1.0
 * @Return:
 **/
public class SimpleFactory {

    public Pizza createPizza(String orderType) {
        Pizza pizza = null;
        if ("cheess".equals(orderType)) {
            pizza = new CheesPizza();
            pizza.setName("cheess");
        } else if ("greek".equals(orderType)) {
            pizza = new GreekPizza();
            pizza.setName("greek");
        }

        return pizza;
    }

    public static Pizza createPizza2(String orderType) {
        Pizza pizza = null;
        if ("cheess".equals(orderType)) {
            pizza = new CheesPizza();
            pizza.setName("cheess");
        } else if ("greek".equals(orderType)) {
            pizza = new GreekPizza();
            pizza.setName("greek");
        }

        return pizza;
    }


}
